/*    */ package com.lmpop.createIndex.search;
/*    */ 
/*    */ import com.lmpop.createIndex.searchModel.SearchData;
/*    */ import com.lmpop.createIndex.searchModel.SearchModel;
/*    */ import java.io.IOException;
/*    */ import java.util.ArrayList;
/*    */ import java.util.Map;
/*    */ 
/*    */ public class ShipingAreaIndexFiles
/*    */ {
/*    */   public ProperUtil properUtil;
/*    */   private String file_path;
/*    */ 
/*    */   public ShipingAreaIndexFiles()
/*    */   {
/* 19 */     this.properUtil = new ProperUtil();
/* 20 */     this.file_path = this.properUtil.getFilePathByModel("shippingarea");
/*    */   }
/*    */ 
/*    */   public double getShippingFee(String shipping_id, String province, double all_goods_amount, double all_goods_weight, int all_goods_num)
/*    */     throws IOException
/*    */   {
/* 27 */     SearchData search = new SearchData();
/* 28 */     ArrayList paraList = new ArrayList();
/* 29 */     paraList.add(new SearchModel("0", "shipping_id", shipping_id));
/* 30 */     paraList.add(new SearchModel("0", "area_id", province));
/* 31 */     Map shipMap = search.getSearchObject(this.file_path, paraList);
/*    */ 
/* 33 */     String cal_type = ""; String one_fare = "0"; String first_fare = "0"; String con_fare = "0"; String free_fare = "0"; String arrive_fare = "0"; String first_weigth = "0";
/* 34 */     if (shipMap.get("cal_type") != null) cal_type = shipMap.get("cal_type").toString();
/* 35 */     if (shipMap.get("one_fare") != null) one_fare = shipMap.get("one_fare").toString();
/* 36 */     if (shipMap.get("first_fare") != null) first_fare = shipMap.get("first_fare").toString();
/* 37 */     if (shipMap.get("con_fare") != null) con_fare = shipMap.get("con_fare").toString();
/* 38 */     if (shipMap.get("free_fare") != null) free_fare = shipMap.get("free_fare").toString();
/* 39 */     if (shipMap.get("arrive_fare") != null) arrive_fare = shipMap.get("arrive_fare").toString();
/* 40 */     double all_shipping_fee = 0.0D;
/* 41 */     if (all_goods_amount >= Double.parseDouble(free_fare))
/*    */     {
/* 43 */       all_shipping_fee = 0.0D;
/*    */     }
/*    */     else
/*    */     {
/* 47 */       if (cal_type.equals("0"))
/*    */       {
/* 49 */         if (all_goods_weight <= 1.0D)
/*    */         {
/* 51 */           all_shipping_fee = Double.parseDouble(first_fare);
/*    */         }
/*    */         else
/*    */         {
/* 55 */           all_shipping_fee = Double.parseDouble(first_fare) + (all_goods_weight - 1.0D) * Double.parseDouble(con_fare);
/*    */         }
/*    */       }
/*    */ 
/* 59 */       if (cal_type.equals("1"))
/*    */       {
/* 61 */         all_shipping_fee = Double.parseDouble(one_fare) * all_goods_num;
/*    */       }
/*    */     }
/*    */ 
/* 65 */     return all_shipping_fee;
/*    */   }
/*    */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.createIndex.search.ShipingAreaIndexFiles
 * JD-Core Version:    0.6.0
 */